package com.dream.keigezhushou.Activity.wigdt;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * RecycleView的item之间的间距
 */

public class SpacingItem extends RecyclerView.ItemDecoration{

    private int space;

    public SpacingItem(int space) {
        this.space = space;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {

        outRect.bottom = space;
        //当条目为第一个条目时
        if (parent.getChildPosition(view) == 0) {

            outRect.top = 0;
        }


    }

}
